﻿package view.popup
{
    import com.sh.game.global.*;
    import com.sh.game.util.*;
    import flash.events.*;
    import flash.filters.*;
    import flash.text.*;
    import manager.*;
    import morn.core.components.*;

    public class UnionTimeUP extends View implements IDialogUI
    {
        public var sureBtn:Button;
        public var cancleBtn:Button;
        protected var uiXML:XML;
        private var titletext:TextField;
        private var tipstext1:TextField;
        private var tipstext2:TextField;

        public function UnionTimeUP()
        {
            this.uiXML = <View>r
n	t	t	t  <Container x=""3"" y=""0"">r
n	t	t	t	t<FlashS9Bg skin=""png.common.ms9"" x=""0"" y=""14"" width=""376"" height=""252""/>r
n	t	t	t	t<Image url=""png.common.title"" x=""74""/>r
n	t	t	t  </Container>r
n	t	t	t  <Image url=""png.common.jyzline"" x=""29"" y=""105"" width=""328""/>r
n	t	t	t  <Button label=""我要捐献"" skin=""png.common.btn_usual_normal"" x=""66"" y=""215"" labelColors=""0xb29a6c, 0xb29a6c, 0xb29a6c"" var=""sureBtn"" labelStroke=""1"" labelFont=""宋体""/>r
n	t	t	t  <Button label=""顺其自然"" skin=""png.common.btn_usual_normal"" x=""235"" y=""215"" labelColors=""0xb29a6c, 0xb29a6c, 0xb29a6c"" var=""cancleBtn"" labelStroke=""1"" labelFont=""宋体""/>r
n	t	t	t</View>")("<View>
			  <Container x="3" y="0">
				<FlashS9Bg skin="png.common.ms9" x="0" y="14" width="376" height="252"/>
				<Image url="png.common.title" x="74"/>
			  </Container>
			  <Image url="png.common.jyzline" x="29" y="105" width="328"/>
			  <Button label="我要捐献" skin="png.common.btn_usual_normal" x="66" y="215" labelColors="0xb29a6c, 0xb29a6c, 0xb29a6c" var="sureBtn" labelStroke="1" labelFont="宋体"/>
			  <Button label="顺其自然" skin="png.common.btn_usual_normal" x="235" y="215" labelColors="0xb29a6c, 0xb29a6c, 0xb29a6c" var="cancleBtn" labelStroke="1" labelFont="宋体"/>
			</View>;
            return;
        }// end function

        override protected function createChildren() : void
        {
            createView(this.uiXML);
            this.init();
            return;
        }// end function

        private function init() : void
        {
            var _loc_1:* = new TextField();
            _loc_1.x = 117;
            _loc_1.y = 2;
            _loc_1.width = 152;
            _loc_1.height = 25;
            _loc_1.defaultTextFormat = new TextFormat("宋体", 15, MColor.New5);
            _loc_1.autoSize = TextFieldAutoSize.CENTER;
            _loc_1.filters = [new GlowFilter(MColor.New27, 1, 2, 2, 2, BitmapFilterQuality.HIGH)];
            _loc_1.selectable = false;
            this.addChild(_loc_1);
            _loc_1.text = "行会解散提醒";
            this.titletext = new TextField();
            this.titletext.x = 70;
            this.titletext.y = 38;
            this.titletext.width = 166;
            this.titletext.height = 25;
            this.titletext.defaultTextFormat = new TextFormat("宋体", 13, MColor.New16);
            this.titletext.autoSize = TextFieldAutoSize.CENTER;
            this.titletext.filters = [new GlowFilter(MColor.New27, 1, 2, 2, 2, BitmapFilterQuality.HIGH)];
            this.titletext.selectable = false;
            this.addChild(this.titletext);
            this.tipstext1 = new TextField();
            this.tipstext1.x = 48;
            this.tipstext1.y = 60;
            this.tipstext1.width = 295;
            this.tipstext1.height = 40;
            this.tipstext1.defaultTextFormat = new TextFormat("宋体", 11, MColor.New6, null, null, null, null, null, null, null, null, null, 2);
            this.tipstext1.autoSize = TextFieldAutoSize.LEFT;
            this.tipstext1.wordWrap = true;
            this.tipstext1.multiline = true;
            this.tipstext1.filters = [new GlowFilter(MColor.New27, 1, 2, 2, 2, BitmapFilterQuality.HIGH)];
            this.addChild(this.tipstext1);
            this.tipstext2 = new TextField();
            this.tipstext2.x = 48;
            this.tipstext2.y = 123;
            this.tipstext2.width = 155;
            this.tipstext2.height = 20;
            this.tipstext2.defaultTextFormat = new TextFormat("宋体", 11, 16777062, null, null, null, null, null, null, null, null, null, 2);
            this.tipstext2.text = "最高活动奖励";
            this.tipstext2.autoSize = TextFieldAutoSize.LEFT;
            this.tipstext2.filters = [new GlowFilter(MColor.New27, 1, 2, 2, 2, BitmapFilterQuality.HIGH)];
            this.addChild(this.tipstext2);
            this.tipstext2.htmlText = MColor.getHMTL("失去行会你会失去：", 5) + "\n" + MColor.getHMTL("高额的行会属性加成\n" + "亲爱的行会战友\n" + "奖励丰厚的行会道具副本\n" + "经验海量的行会经验副本\n", 7) + MColor.getHMTL("从此，您将一个人行走江湖，只有孤单陪伴您！", 7);
            this.sureBtn.addEventListener(MouseEvent.CLICK, this.onCanJia);
            this.cancleBtn.addEventListener(MouseEvent.CLICK, this.onClose);
            GlobalLayer.instance.root.addEventListener(Event.RESIZE, this.resizeHandler);
            this.x = GlobalLayer.instance.root.stage.stageWidth - this.width - 50;
            this.y = GlobalLayer.instance.root.stage.stageHeight - this.height - 100;
            return;
        }// end function

        protected function onClose(event:MouseEvent) : void
        {
            this.close();
            return;
        }// end function

        protected function onCanJia(event:Event) : void
        {
            this.close();
            PluginManager.instance.openPlugin("union", UIGlobel.pointsDic["union"], 4);
            return;
        }// end function

        override protected function initialize() : void
        {
            super.initialize();
            return;
        }// end function

        public function show(param1:Object) : void
        {
            this.titletext.htmlText = MColor.getHMTL("您所在的行会剩余行会资金：", 5) + MColor.getHMTL(param1[0], 9);
            this.tipstext1.htmlText = MColor.getHMTL("不足用于今日行会维护费用的扣除！请在晚上7点前，积累行会资金到至少", 5) + MColor.getHMTL(param1[1], 9) + MColor.getHMTL("；（还需要至少", 5) + MColor.getHMTL(param1[1] - param1[0] + "", 9) + MColor.getHMTL("行会资金）否则行会会被系统强制解散！", 5);
            return;
        }// end function

        public function close() : void
        {
            this.visible = false;
            return;
        }// end function

        private function resizeHandler(event:Event) : void
        {
            this.x = GlobalLayer.instance.root.stage.stageWidth - this.width - 50;
            this.y = GlobalLayer.instance.root.stage.stageHeight - this.height - 100;
            return;
        }// end function

    }
}
